// =====================================================================================
// 
//       Filename:  udt_submit.c
// 
//    Description:  
// 
//        Created:  1/13/2010 11:20:23 PM
//       Compiler:  g++
// =====================================================================================

#include "udt/udt_interface.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>


int max_attrib_used = 3;
int max_depth = 20;
double stop_criteria = 0.1;
double min_entropy_gain = -100;

UDTDataLinkSet trainSet, testSet;
UDTTreeObject root;


int main(int argc, char **argv)
{
    int i = 2;
    int attribUsed[MAX_ATTRIB];
    char trainName[250], testName[250], outputName[250];
    
    if (argc < 4) {
        printf("Usage: udt train_file test_file out_file\n");
        return -1;
    };

    strcpy(trainName, argv[1]);
    strcpy(testName,  argv[2]);
    strcpy(outputName, argv[3]);    

    udt_inputData_Raw(trainName, &trainSet);
    udt_inputData_Raw(testName, &testSet);

    printf("Training\n");

    memset(attribUsed, 0, sizeof(int)*MAX_ATTRIB);
    udt_train(&trainSet, &root, attribUsed, 0);

    printf("Testing\n");
    udt_testDataSet_File(&testSet, &root, outputName, trainSet.labelCount);
    
    return 0;
};    

